import time
from selenium.webdriver.support.wait import WebDriverWait
from selenium import webdriver
def connect_wb(driver_path=r'C:\Program Files\Google\Chrome\Application\chromedriver.exe'):

    driver=webdriver.Chrome(driver_path)
    return driver

def input_text(element,text):
    element.clear()
    element.send_keys(text)

def get_element(driver,style,value):
    driver.element=WebDriverWait(driver,2)
    element=driver.element.until(lambda driver:driver.find_element(by=style,value=value))
    return element


def is_location(driver,style,value):
    try:
        element=get_element(driver=driver,style=style,value=value)
    except Exception as e:
        print('当前规则，定位不到元素-----》', value)
        print(e)
    else:
        return element
    finally:
        print('好的')
